﻿<navigation:Page x:Class="ADministration.Views.Categories" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"  
           mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           d:DesignWidth="640" d:DesignHeight="480"
           Title="Categories Page" xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices" xmlns:my="clr-namespace:ADministration.Web" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">

    <toolkit:BusyIndicator HorizontalAlignment="Stretch" Name="busyIndicator" VerticalAlignment="Stretch"
                           IsBusy="{Binding ElementName=categoryDomainDataSource, Path=IsBusy}">
        <Grid x:Name="LayoutRoot">

            <TextBlock x:Name="HeaderText" Style="{StaticResource HeaderTextStyle}" 
                           Text="{Binding Path=Strings.CategoriesPageTitle, Source={StaticResource ApplicationResources}}" Margin="12,12,0,7" />

            <riaControls:DomainDataSource AutoLoad="True" 
                                      Name="categoryDomainDataSource" QueryName="GetCategoriesQuery"
                                      d:DesignData="{d:DesignInstance my:Category, CreateList=true}" 
                                      LoadedData="categoryDomainDataSource_LoadedData" >
                <riaControls:DomainDataSource.DomainContext>
                    <my:TicketsDomainContext />
                </riaControls:DomainDataSource.DomainContext>
                <riaControls:DomainDataSource.SortDescriptors>
                    <riaControls:SortDescriptor PropertyPath="CategoryID" Direction="Ascending" />
                </riaControls:DomainDataSource.SortDescriptors>
            </riaControls:DomainDataSource>

            <sdk:DataGrid AutoGenerateColumns="False" Height="200" HorizontalAlignment="Left" 
                      ItemsSource="{Binding ElementName=categoryDomainDataSource, Path=Data}" Margin="12,52,0,0" 
                      Name="categoryDataGrid" RowDetailsVisibilityMode="VisibleWhenSelected" 
                      VerticalAlignment="Top" Width="555" MinWidth="250">
                <sdk:DataGrid.Columns>
                    <sdk:DataGridTextColumn x:Name="categoryIDColumn" 
                                                Binding="{Binding Path=CategoryID, Mode=OneWay}" 
                                        Header="Category ID" IsReadOnly="True" Width="Auto" />
                    <sdk:DataGridTextColumn x:Name="nameColumn" Binding="{Binding Path=Name}" Header="Name" 
                                        Width="Auto" />
                </sdk:DataGrid.Columns>
            </sdk:DataGrid>

            <Button Content="Relaod" Height="26" HorizontalAlignment="Left" Margin="12,267,0,0"
            Name="buttonRelaod" VerticalAlignment="Top" Width="75" Click="buttonRelaod_Click" />
            <Button Content="Add" Height="26" HorizontalAlignment="Left" Margin="93,267,0,0"
            Name="buttonAdd" VerticalAlignment="Top" Width="75" Click="buttonAdd_Click" />
            <Button Content="Save Changes" Height="26" HorizontalAlignment="Left" Margin="174,267,0,0"
            Name="buttonSaveChanges" VerticalAlignment="Top" Width="106" Click="buttonEdit_Click" />
            <Button Content="Delete" Height="26" HorizontalAlignment="Left" Margin="286,267,0,0"
            Name="buttonDelete" VerticalAlignment="Top" Width="75" Click="buttonDelete_Click" />
            <sdk:DataPager Height="26" HorizontalAlignment="Left"  Name="dataPager1" 
                       PageSize="7" VerticalAlignment="Top" Width="200"
                       Source="{Binding ElementName=categoryDomainDataSource, Path=Data}" Margin="367,267,0,0" />
            <TextBox Height="26" HorizontalAlignment="Left" Margin="286,21,0,0" 
                     x:Name="textBoxSearchName" VerticalAlignment="Top" Width="156" />
            <Button Content="Search By Name" Height="26" HorizontalAlignment="Left" Margin="448,21,0,0" 
                    x:Name="buttonSearch" VerticalAlignment="Top" Width="119" Click="buttonSearch_Click" />
        </Grid>
    </toolkit:BusyIndicator>
</navigation:Page>
